﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MODEL;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using System.Windows.Input;

namespace ViewModel.AlertCreate
{
    public class AlertRecordDetailViewModel:ViewModelBase
    {
        public ViewModelBase ParentViewModel { get; set; }

        public ICommand ResolvedAlertCommand { get; set; }

        private AlertRecord m_AlertRecord = new AlertRecord();
        public AlertRecord AlertRecord
        {
            get { return this.m_AlertRecord; }
            set { this.m_AlertRecord = value; base.RaisePropertyChanged(); }
        }

        private StationData m_StationData;
        public StationData StationData
        {
            get { return this.m_StationData; }
            set { this.m_StationData = value; base.RaisePropertyChanged(() => this.StationData); }
        }


        public AlertRecordDetailViewModel()
        {
            this.ResolvedAlertCommand = new RelayCommand(ShowMessageReleaseForm,()=>this.AlertRecord.Resolved==0);
        }

        private void ShowMessageReleaseForm()
        {
            this.MessengerInstance.Send<object>(null, "AlertRecord_CloseForm");
            (this.ParentViewModel as AlertRecordViewModel).ShowMessageReleaseForm(this.AlertRecord);
        }
    }
}
